<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition   xmlns="http://www.w3.org/1999/xhtml"
			      xmlns:h="http://java.sun.com/jsf/html"
				  xmlns:p="http://primefaces.org/ui"
			      xmlns:f="http://java.sun.com/jsf/core"
			      xmlns:ui="http://java.sun.com/jsf/facelets"
			      > 
	
	
	 
	    <p:panel header="Search Options" toggleable="true" toggleOrientation="vertical" collapsed="false">  
   		<p:panelGrid columns="6" style="margin-bottom:10px;font-size:14px;" cellpadding="5">  
  		<f:facet name="header">  
        
    	</f:facet>  
  
        <h:outputText value="File Name: " />  
        <p:inputText value="#{dirsManagedBean.fileName}"></p:inputText>  
        
          <h:outputText value="Region: " /> 
        <p:selectOneMenu style="width:170px" value="#{dirsManagedBean.region}"> 
        	<f:selectItem itemLabel="--Select Region--" itemValue="" />   
            <f:selectItems value="#{servicesManagedBean.regionList}" />  
            <p:ajax update="countries" listener="#{dirsManagedBean.updateCountries}" />
        </p:selectOneMenu>
  
        <h:outputText value="Country: " /> 
        <p:selectOneMenu style="width:180px" id="countries" value="#{dirsManagedBean.country}">
        	<f:selectItem itemLabel="--Select Country--" itemValue="" />    
            <f:selectItems value="#{dirsManagedBean.countriesList}" />  
        </p:selectOneMenu>      
        
        
        <h:outputText value="Date      From: " />  
 		<p:calendar id="from"  styleClass="calendarFilter" pattern="dd-MMM-yy" value="#{dirsManagedBean.from}" showOn="button" required="true" requiredMessage="Required">
        </p:calendar>
        
        <h:outputText value="To: " />
        <p:calendar id="to"  styleClass="calendarFilter" pattern="dd-MMM-yy" value="#{dirsManagedBean.to}" showOn="button" required="true" requiredMessage="Required">
        </p:calendar>
         
         <p:column colspan="7">  
        <p:commandButton value="GO" update="LoadedFilesdataTable" action="#{dirsManagedBean.updateList}" global="true" />
        </p:column> 
    </p:panelGrid>
    
    </p:panel>    
    
<p:panel id="LoadedFilesdataTable"> 
<p:dataTable  rendered="#{dirsManagedBean.methodCalled}"
			  style="margin-top:5px" 
			  var="dir" value="#{dirsManagedBean.dlist}"  
              paginator="true" 
              rows="30"   
              paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
              rowsPerPageTemplate="20,40,60,80" 
              lazy="true"    
              scrollRows="17" 
              sortBy="#{dir.finishTimestamp.day}"
              >  
        <f:facet name="header">  
            Chub Loaded Files  
        </f:facet> 
        <p:column >  
            <f:facet name="header">  
                    FileName
            </f:facet>  
            #{dir.filename}  
        </p:column>  
  
        <p:column >  
            <f:facet name="header" >  
                    Country 
            </f:facet>  
            #{dir.countryName} 
        </p:column>  
  
  
        <p:column>
        <f:facet name="header">  
                    Finish Date 
            </f:facet>  
            #{dir.finishTimestamp} 
        </p:column>  
        
        <p:column>
        <f:facet name="header">  
                   Time 
            </f:facet>  
            #{dir.executiontime} 
        </p:column>
               
        <p:column>
        <f:facet name="header" >  
                    Max Date
            </f:facet>  
            #{dir.filesMaxDate} 
        </p:column> 
        
        <p:column>
        <f:facet name="header" >  
                    Min Date 
            </f:facet>  
            #{dir.filesMinDate} 
        </p:column>
        
       
		<p:summaryRow>
		<p:column colspan="6" >    
            </p:column> 
        </p:summaryRow> 
   
    </p:dataTable> 
     </p:panel>
   
</ui:composition>